#include <stdio.h>

int main(int argc, char const *argv[])
{
    char buf[100]={0};
    printf("请输入一个字符串>:");
    scanf("%s",buf);
    printf("buf=%s\n",buf);

    int len = 0;
    while(buf[len] != '\0')//如果buf[len] == '\0' ，是字符串的结束标志
    {
        len ++;
    }
    printf("len=%d\n",len);

    char t;
    for(int i=0;i<len/2;i++)
    {
        t = buf[i];
        buf[i] = buf[len - 1 - i];
        buf[len - 1 - i] = t;
    }
    printf("buf=%s\n",buf);

    return 0;
}
